* This file cleans all data for analyzing the list experiments on the 2008 CCAP module. The list experiments deal with African American, gay, Muslim, and female presidential candidates. Current as of Thursday, May 28, 2020

* Run from Macintosh Air. 
* log using "\\Client\C$\Users\ericschmidt\Dropbox\Base Dropbox\List Experiment Paper (PS)\Conditional Accept\Replication Files (Carmines-Schmidt PS)\2008 CCAP\Dataset Creation\dataset-creation.log", replace
* use "\\Client\C$\Users\ericschmidt\Dropbox\Base Dropbox\List Experiment Paper (PS)\Conditional Accept\Replication Files (Carmines-Schmidt PS)\2008 CCAP\Dataset Creation\CCAP-2008-raw.dta", clear 
* set more off 

* Baseline condition: list experiment item count
tab mar_IND48A
gen baseline_le = mar_IND48A
tab baseline_le
recode baseline_le 1=0 2=1 3=2 4=3 5=4
tab baseline_le
tab baseline_le mar_IND48A, m

* "African American candidate": list experiment item count
tab mar_IND48B
gen afroam_le = mar_IND48B
tab afroam_le
recode afroam_le 1=0 2=1 3=2 4=3 5=4 6=5
tab afroam_le
tab afroam_le mar_IND48B, m

* "'Gay or homosexual' candidate": list experiment item count
tab mar_IND48C
gen gays_le = mar_IND48C
tab gays_le
recode gays_le 1=0 2=1 3=2 4=3 5=4 6=5
tab gays_le
tab gays_le mar_IND48C, m

* "Muslim candidate": list experiment item count
tab mar_IND48D
gen muslim_le = mar_IND48D
tab muslim_le
recode muslim_le 1=0 2=1 3=2 4=3 5=4 6=5
tab muslim_le
tab muslim_le mar_IND48D, m

* "Woman candidate": list experiment item count
tab mar_IND48E
gen female_le = mar_IND48E
tab female_le 
recode female_le 1=0 2=1 3=2 4=3 5=4 6=5
tab female_le
tab female_le mar_IND48E, m

* Treatment group
gen treatment = "Control" if baseline_le != . 
replace treatment = "African Americans" if afroam_le !=. 
replace treatment = "Gays" if gays_le !=. 
replace treatment = "Muslims" if muslim_le !=. 
replace treatment = "Women" if female_le !=. 
tab treatment
* Check the different cross-tabs 
tab treatment baseline_le, m
tab treatment afroam_le, m
tab treatment gays_le, m
tab treatment muslim_le, m
tab treatment female_le, m
 
* Item count total, regardless of treatment. 
gen item_count = baseline_le if baseline_le != . 
replace item_count = afroam_le if afroam_le != . 
replace item_count = gays_le if gays_le != . 
replace item_count = muslim_le if muslim_le != .
replace item_count = female_le if female_le != . 
tab item_count
* Check cross-tabs
tab item_count treatment, m
tab baseline_le
tab afroam_le
tab gays_le 
tab muslim_le 
tab female_le
* Check 

* Partisanship (7-point scale). 
tab mcap8 
gen pid_7 = mcap8
tab pid_7 
recode pid_7 1=0 2=1 3=2 4=3 5=4 6=5 7=6 8=. 
tab pid_7 
tab mcap8 pid_7, m
* 0-to-6 scale, where 0 = strong Democrat and 6 = strong Republican. 

* Democrat. Code independents as leaners. 
tab mcap8 
gen democrat = mcap8
tab democrat 
recode democrat (1/3 = 1) (4/8 = 0)
tab democrat
tab democrat mcap8, m
* Binary variable, 1 = Democrat; 0 = not Democrat. 

* Republican. Code independents as leaners. 
tab mcap8
gen republican = mcap8
tab republican 
recode republican (1/4 = 0) (8 = 0) (5/7 = 1)
tab republican
tab republican mcap8, m 
* Binary variable, 1 = Republican; 0 = not Republican. 

* Ideology (5-point scale).
tab mcap700s
gen ideology = mcap700s
tab ideology
recode ideology 1=0 2=1 3=2 4=3 5=4 6=. 
tab ideology
tab mcap700s ideology, m
* 0-to-4 scale where 0 = very liberal and 4 = very conservative. 

* Liberal. 
tab mcap700s
gen liberal = mcap700s
tab liberal
recode liberal (1/2 = 1) (3/6 = 0)
tab liberal 
tab mcap700s liberal, m
* Binary variable, 1 = liberal; 0 = not liberal. 

* Conservative. 
tab mcap700s
gen conservative = mcap700s
tab conservative
recode conservative (1/3 = 0) (4/5 = 1) (6 = 0)
tab conservative
tab mcap700s conservative, m 
* Binary variable, 1 = conservative; 0 = not conservative. 

* Gender 
tab profile54
gen female = profile54
tab female
recode female 2=1 1=0
tab female
tab female profile54, m 
* Binary variable, 1 = female; 0 = male 

* Black 
tab profile55 
gen black = profile55
tab black 
recode black (1 = 0) (2 = 1) (3/8 = 0) 
tab black
tab black profile55, m 
* Binary variable, 1 = black; 0 = not black 

* White
tab profile55
gen white = profile55
tab white
recode white (1 = 1) (2/8 = 0) 
tab white
tab white profile55, m 
* Binary variable, 1 = white, 0 = not white 

* Education (6-point scale) 
tab profile57
gen education = profile57
tab education
recode education 1=0 2=1 3=2 4=3 5=4 6=5 
tab education 
tab education profile57, m 
* 0-to-5 scale, 0 = no HS; 1 = high school graduate; 2 = some college; 3 = 2-year college; 4 = college graduate; 5 = post-graduate 

* Church attendance
tab profile30
gen church = profile30
tab church
recode church 1=8 2=7 3=6 4=5 5=4 6=3 7=2 8=1 9=0
tab church 
tab church profile30, m
* 0-to-8 scale, 0 = never; 8 = more than one per week

* Racial resentment, question 1. 
* "Generations of slavery and discrimination have created conditions that make it difficult for Blacks to work their way out of the lower class." Strongly agree is the LEAST racially resentful response; strongly disagree is the MOST racially resentful response. 
tab mcap73
gen rr_1 = mcap73
tab rr_1
recode rr_1 1=-2 2=-1 3=0 4=1 5=2
tab rr_1 
tab rr_1 mcap73, m
* -2-to-2 scale, -2 = strongly agree; 2 = strongly disagree 

* Racial resentment, question 2. 
* "Irish, Italians, Jewish, and many other minorities overcame prejudice and worked their way up. Blacks should do the same without any special favors." Strongly agree is the MOST racially resentful response, and strongly disagree is the LEAST racially resentful response. 
tab mcap70
gen rr_2 = mcap70
tab rr_2
recode rr_2 1=2 2=1 3=0 4=-1 5=-2
tab rr_2 
tab rr_2 mcap70, m 
* -2-to-2 scale, -2 = strongly disagree; 2 = strongly agree 

* Racial resentment, question 3. 
* "Over the past few years, blacks have gotten less than they deserve." Strongly agree is the LEAST racially resentful response, and strongly disagree is the MOST racially resentful response.
tab mcap71
gen rr_3 = mcap71
tab rr_3
recode rr_3 1=-2 2=-1 3=0 4=1 5=2 
tab rr_3 
tab rr_3 mcap71, m 
* -2-to-2 scale, -2 = strongly agree; 2 = strongly disagree 

* Racial resentment, question 4. 
* "It's really a matter of some people not trying hard enough. If blacks would only try harder, they could be just as well off as whites." Strongly agree  is the MOST racially resentful response, and strongly disagree is the LEAST racially resentful response. 
tab mcap72
gen rr_4 = mcap72
tab rr_4
recode rr_4 1=2 2=1 3=0 4=-1 5=-2 
tab rr_4 
tab rr_4 mcap72, m 
* -2-to-2 scale, -2 = strongly disagree; 2 = strongly agree 

* Racial resentment index 
gen rr = rr_1 + rr_2 + rr_3 + rr_4 
tab rr
* -8 to 8 scale, where -8 is the lowest level of racial resentment and 8 is the highest level of racial resentment.  

* Hillary Clinton favorability 
tab mcap300c 
gen clinton_favor = mcap300c
tab clinton_favor 
recode clinton_favor (0 5 = 2) (1 = 3) (2 = 4) (3 = 1) (4 = 0) 
tab clinton_favor 
tab clinton_favor mcap300c, m
* 0-to-4 scale, 0 = very unfavorable; 1 = somewhat unfavorable; 2 = neutral or haven't heard enough; 3 = somewhat favorable; 4 = very favorable 

* Barack Obama favorability
tab mcap300o
gen obama_favor = mcap300o
tab obama_favor 
recode obama_favor (0 5 = 2) (1 = 3) (2 = 4) (3 = 1) (4 = 0) 
tab obama_favor 
tab obama_favor mcap300o, m
* 0-to-4 scale, 0 = very unfavorable; 1 = somewhat unfavorable; 2 = neutral or haven't heard enough; 3 = somewhat favorable; 4 = very favorable 

* Political interest. (Level of interest in politics or current affairs) 
tab mcap813 
gen interest = mcap813 
tab interest 
recode interest 1=2 2=1 3=0 
tab interest
tab interest mcap813, m 
* 0 = not that much; 1 = somewhat interested; 2 = very interested

* Family income
tab profile59
gen income = profile59
tab income
recode income 15 = . 
tab income
replace income = income - 1
tab income
tab income profile59, m 
* 0-to-13 scale, 0 = less than $10,000; 13 = $150,000 or more. I've dropped the 113 people that "prefer not to say." 

* Dummy variable: "African American candidate" condition. 
gen afroam_treatment = 0 if treatment!=""
replace afroam_treatment = 1 if afroam_le!=. 
tab afroam_treatment
tab afroam_treatment treatment, m 
tab afroam_treatment item_count, m  
tab afroam_le 
* Binary indicator of treatment condition. 1 = assigned to "African American candidate" condition; 0 = assigned to other conditions. 

* Dummy variable: Baseline condition. 
gen baseline_treatment = 0 if treatment!=""
replace baseline_treatment = 1 if baseline_le!=. 
tab baseline_treatment
tab baseline_treatment treatment, m 
tab baseline_treatment item_count, m 
tab baseline_le 
* Binary indicator of treatment condition. 1 = assigned to baseline condition; 0 = assigned to other conditions. 

* Dummy variable: "'Gay or Homosexual' candidate" condition. 
gen gay_treatment = 0 if treatment!=""
replace gay_treatment = 1 if gays_le!=. 
tab gay_treatment
tab gay_treatment treatment, m 
tab gay_treatment item_count, m 
tab gays_le 
* Binary indicator of treatment condition. 1 = assigned to "'Gay or Homosexual' candidate" condition; 0 = assigned to other conditions. 

* Dummy variable: "Muslim candidate" condition. 
gen muslim_treatment = 0 if treatment!=""
replace muslim_treatment = 1 if muslim_le!=. 
tab muslim_treatment
tab muslim_treatment treatment, m 
tab muslim_treatment item_count, m
tab muslim_le 
* Binary indicator of treatment condition. 1 = assigned to "Muslim candidate" condition; 0 = assigned to other conditions. 

* Dummy variable: "Woman candidate" condition. 
gen female_treatment = 0 if treatment!=""
replace female_treatment = 1 if female_le!=. 
tab female_treatment
tab female_treatment treatment, m 
tab female_treatment item_count, m 
tab female_le 
* Binary indicator of treatment condition. 1 = assigned to "woman candidate" condition; 0 = assigned to other conditions. 

* "African American candidate" or baseline condition 
gen afroam_binary = . 
replace afroam_binary = 0 if baseline_treatment==1 
replace afroam_binary = 1 if afroam_treatment==1
tab afroam_binary
tab afroam_binary treatment, m
* Binary variable, 1 = assigned to "African American candidate" condition; 0 = assigned to baseline condition. 

* "'Gay or homosexual' candidate" or baseline condition
gen gays_binary = . 
replace gays_binary = 0 if baseline_treatment==1 
replace gays_binary = 1 if gay_treatment==1
tab gays_binary
tab gays_binary treatment, m
* Binary variable, 1 = assigned to "'Gay or homosexual' candidate" condition; 0 = assigned to baseline condition. 

* "Muslim candidate" or baseline condition 
gen muslim_binary = . 
replace muslim_binary = 0 if baseline_treatment==1 
replace muslim_binary = 1 if muslim_treatment==1
tab muslim_binary
tab muslim_binary treatment, m
* Binary variable, 1 = assigned to "Muslim candidate" condition; 0 = assigned to baseline condition. 

* "Woman candidate" or baseline condition  
gen female_binary = . 
replace female_binary = 0 if baseline_treatment==1
replace female_binary = 1 if female_treatment==1
tab female_binary
tab female_binary treatment, m
* Binary variable, 1 = assigned to "Woman candidate" condition; 0 = assigned to baseline condition. 

* Save to an external file. 
* save "\\Client\C$\Users\ericschmidt\Dropbox\Base Dropbox\List Experiment Paper (PS)\Conditional Accept\Replication Files (Carmines-Schmidt PS)\2008 CCAP\Dataset Creation\CarminesSchmidtPS-replication-2008.dta", replace

exit, clear
